<?php
define ('LIST_TYPE_DETAIL', 1);
define ('LIST_TYPE_BROWSE', 2);

class News_UI_View
{
	var $Controller  = NULL;
	var $Params      = array();
	var $Toolbar     = NULL;
	var $BreadCrumbs = array();
	var $Buttons     = array();
	var $Cells       = array();
	var $Controlbar  = NULL;
	var $Onload      = NULL;
	var $Type        = LIST_TYPE_BROWSE;
	function News_UI_View($controller)
	{
		$this->Controller = $controller;
	}
	
	function Display ()
	{//'header', 'main', 'controlbar', 'toolbar', 'onload'
		$this->Params['toolbar']    = $this->Toolbar;
		$this->Params['controlbar'] = $this->Controlbar;
		$this->Params['onload']     = $this->Onload; 
		$this->Params['header']     = implode (' &#187; ', $this->BreadCrumbs);
		
		$this->Params['header'] .= '<div style="float:right;">';
		foreach ($this->Buttons as $button)
		{
			$this->Params['header'] .= $this->Controller->Factory->Button($button['uri'], $button['text'], $button['icon']); 
		}
		$this->Params['header'] .= '</div>';
		
		
		foreach ($this->Cells as $cell) 
		{
			$this->Params['main'] .=$this->Controller->Factory->Thumbnail ($cell['image'], $cell['uri'], $cell['caption'], $cell['error']);
		} 
		
		return $this->Controller->Structure ($this->Params);
	}
}
